<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id='hello'>
        <!-- vfor 先在外层进行遍历 后面才能使用item -->
        <label v-for="(item, index) in ServiceData" :key="item" >
            <!-- vfor遍历拿到服务器的每一项数据item,赋值给对应的id和value值 -->
            <input type="checkbox"  :key="item" :id="index" :value="item" v-model="hobbies">{{item}}
        </label>
        <h5>your hobbies is{{hobbies}}</h5>
    </div>
    <script src="../../vue.js"></script>
    <script>
        const vueApp = new Vue({
            el: '#hello',
            data: {
                hobbies:[],
                //模拟服务器的数据
                ServiceData:['唱','跳','rap','篮球'],
            },
        })
    </script>

</body>

</html>